package com.huatai.datadevelop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huatai.datadevelop.entity.TableManageEntity;
import org.apache.ibatis.annotations.*;

/**
 * @Author zhangbenting
 * @Description TODO
 * @Date 2023/9/1 11:38
 * @Version 1.0
 */
@Mapper
public interface TableManageMapper extends BaseMapper<TableManageEntity> {

	/**
	 * 删除表格
	 *
	 * @param tableName
	 * @return
	 */
	@Update(" Drop table if exists  ${tableName}  ")
	Boolean deleteTable(@Param("tableName") String tableName);

	/**
	 * 统计数据条数
	 *
	 * @param tableName
	 * @return
	 */
	@Select("select count(*) from ${tableName}")
	Integer countData(@Param("tableName") String tableName);

	/**
	 * 根据表名清空数据
	 *
	 * @param tableName
	 * @return
	 */
	@Delete(" delete from   ${tableName} ${whereStr}  ")
	Boolean deleteAllDataByTableName(@Param("tableName") String tableName, @Param("whereStr") String whereStr);
}
